﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using DWF.Studio.RemoteCtrls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DWF.Studio.Host.RemoteHandler
{
    public class GenericFuncHandlerHandler<T> : MarshalByRefProxyBase
    {
        private Func<T> _func = null;

        /// <summary>
        /// 设置事件响应Action
        /// </summary>
        /// <param name="action"></param>
        public void SetFunc(Func<T> func)
        {
            _func = func;
        }

        public T Invoke()
        {
            T t = default(T);
            if (_func != null)
            {
                t = _func();
            }

            return t;
        }
    }
}
